<?php


namespace App\Http\Validator;


use App\Http\Common\BaserValidate;

class UserValidator extends BaserValidate
{
    protected $rule = [
        'password'  =>  'required|regex:/^[0-9a-zA-Z]{8,16}$/',
        'confirmPassword'=> 'required|regex:/^[0-9a-zA-Z]{8,16}$/',
        'phone'     =>  'required|regex:/^1[34578]\d{9}$/',
        'code'      =>  'required|digits_between:6,6',
        'route_url' =>  'required',
        'route_name'=>  'required',
        'route_method'=>  'required',
        'username'=>'required',
        'email'=>'required',
        'grade_id'=>'required',

    ];

    protected $message = [
        'username.required' =>  '用户名不能为空',
        'password.required' =>  '密码不能为空',
        'password.regex'    =>  '密码只能是8-16英文和数字',
        'confirmPassword.required'  =>  '确认密码不能为空',
        'confirmPassword.regex'  =>  '确认密码只能是8-16英文和数字',
        'phone.required'    =>  '手机号码不能为空',
        'phone.regex'       =>  '请输入正确的手机号码1',
        'code.required'     =>  '验证码不能为空',
        'code.digits_between'    =>  '验证码长度为6位',
        'route_url.required'    =>  '路由路径不能为空',
        'route_name.required'   =>  '路由名不能为空',
        'route_method.required' =>  '路由方法不能为空',
        'email.required'=>'邮箱不能为空',
        'grade_id.required'=>'年级ID不能为空',


    ];

    protected $scene = [
        'updatePass'    =>  ['password', 'confirmPassword'],
        'updatePhone'   =>  ['phone', 'code'],
        'note'    =>  ['route_url', 'route_name', 'route_method'],
        'createUser' =>['username', 'email', 'grade_id', 'password']
    ];
}
